/*
 *  LEDCleanListener.java
 * 
 *  copyright (c) 2006, tom dinchak & lorenzo orselli
 * 
 *  This file is part of jserialio.
 *
 *  jserialio is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation; either version 2 of the License, or
 *  (at your option) any later version.
 *
 *  jserialio is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *  You should have received a copy of the GNU General Public License
 *  along with jserialio; if not, write to the Free Software
 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 *
 * 
 *  created on July 29, 2006, 1:08 AM
 *
 */

package serialio;

import java.io.*;
import com.illposed.osc.*;

/**
 *
 * @author lorenzo
 */
public class LEDResetListener implements OSCListener {
    Object args[];
    OutputStream serialout;
    
    public LEDResetListener(OutputStream newserialout) {
        this.serialout = newserialout;
    }
    
    public void acceptMessage(java.util.Date time, OSCMessage message) {
        try {

        	for (int col = 0; col < 7; col++) {
        	
            int msb = MonomeProtocol.LED_COL + col;
            int lsb = 0;
                        
            byte[] out = new byte[2];
            out[0] = (byte)msb;
            out[1] = (byte)lsb;
            serialout.write(out);
        	}
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
